package com.omkarpatil.learningjpa2.mapping.basic.secondarytable.embedded;

import javax.persistence.EntityManager;

import com.omkarpatil.learningjpa2.util.EntityManagerFactoryFactory;

public class TestDriver {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		EntityManager em = EntityManagerFactoryFactory.getEntityManagerFactory().createEntityManager();
		em.getTransaction().begin();
		
		System.out.println("##### Adding Employee to database ...");
		Address addr = new Address("61, Wellington Road", "Bournemouth", "Dorset", "BH88JL");
		
		Employee emp = new Employee("Mr. A. Smith", addr);
		
		em.persist(emp);
		
		em.getTransaction().commit();
		em.close();
		System.out.println("##### Please take a look at database. Secondary tables usage is not visible in java code ...");
	}

}
